package com.testmall.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.testmall.entity.Product;
import com.testmall.entity.Shopping;
import com.testmall.entity.common.PageBean;
import com.testmall.entity.common.ResultBean;
import com.testmall.service.ProductService;
import com.testmall.service.ShoppingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @Description:
 * @Author: k23
 * @Date: 2022-06-28 14:04
 * @Version: 1.0
 */
@RestController
@RequestMapping("/api/shopping")
@Api(value = "收货信息接口", tags = "收货信息接口")
public class ShoppingController extends BaseController{
    @Autowired
    ShoppingService shoppingService;

    @PostMapping("/save")
    @ApiOperation(value = "保存收货信息", notes = "保存收货信息")
    public Boolean saveShopping(Shopping shopping) {
        return shoppingService.save(shopping);
    }

    @PostMapping("/query")
    @ApiOperation(value = "查询收货信息", notes = "查询收货信息")
    public ResultBean queryShopping(@RequestBody Map map) {
        PageBean bean = shoppingService.querypage(map);
        return success("订单列表", bean);
    }

    @GetMapping("/delect/{id}")
    @ApiOperation(value = "删除收货信息", notes = "删除收货信息")
    public Boolean delectShopping(@PathVariable int id) {
        return shoppingService.removeById(id);
    }

    @GetMapping("/update")
    @ApiOperation(value = "修改收货信息", notes = "修改收货信息")
    public Boolean updatShopping(Shopping shopping) {
        return shoppingService.updateById(shopping);
    }

}
